<template>
    <div>
        <am-white-space size="lg"></am-white-space>
        <am-wing-blank size="sm">
            <yx-radio :data="radioData" v-model="value"  placeholder="请选择" label="水果"></yx-radio>
        </am-wing-blank>

        <am-white-space size="lg"></am-white-space>
        <am-wing-blank size="sm">
            <am-button @click="getValue">获取值</am-button>
        </am-wing-blank>

        <am-white-space size="lg"></am-white-space>
        <am-wing-blank size="sm">
            <am-button @click="randomValue">随机切换值</am-button>
        </am-wing-blank>
    </div>
</template>

<script>
    import AmWingBlank from "../../../weex-amui/packages/am-wing-blank/index";
    import YxRadio from "../../../components/yx-radio/index";
    import AmWhiteSpace from "../../../weex-amui/packages/am-white-space/index";
    import AmButton from "../../../weex-amui/packages/am-button/index";
    import Utils from 'Utils/utils'
    export default {
        name: "radio-demo",
        components: {AmButton, AmWhiteSpace, YxRadio, AmWingBlank},
        data (){
            return {
                radioData: [
                    {
                        label:'苹果',
                        value: 1
                    },
                    {
                        label: '橘子',
                        value: 2
                    }
                ],
                value:1
            }
        },
        methods: {
            getValue (){
                this.$notice.toast({
                    message: JSON.stringify(this.value)
                })
            },
            randomValue (){
                let l = Utils.randomNum(1,2)
                // this.$notice.toast({
                //     message: JSON.stringify(l)
                // })
                this.value = l
            }
        }
    }
</script>

<style scoped>

</style>
